<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>为li元素添加内容</title>
    <script src="jQuery-3.6.3.min.js"> </script>
    <script>
        $(function () {
            var arrays=["HTML","CSS","Javascript","Jquery"];
            $("#a2").click(function () {
           
                $("li").each(function (index){
                    var a=arrays[index];
                    $(this).text(a);
                });
          
            });
        })
    </script>
</head>

<body>
    <ol>
       
    <li></li>
    <li></li>
    <li></li>
    <li></li></ol>
    
    <input id="a2" type="button" value="包裹元素" />
</body>

</html>